pkg_name=lboxwm
git_commit=da6349e771726ee3a24372bd5c8e47b8a898b48f
build_dir=$builds_dir_root/$pkg_name
pkg_dir=$pkgs_dir_root/$pkg_name
src_dir=$src_dir_root/$pkg_name
url=https://github.com/sylware/$pkg_name.git

rm -Rf "$pkg_dir"
cp -r "$src_dir" "$pkg_dir"

cd "$pkg_dir"

git checkout --force $git_commit
git reset --hard

rm -Rf "$build_dir"
mkdir -p "$build_dir"
cd "$build_dir"

$pkg_dir/make

install_tmp_dir=/tmp/$pkg_name
rm -Rf "$install_tmp_dir"
mkdir -p "$install_tmp_dir/bin"
chmod 755 "$install_tmp_dir/bin"
cp -f "$build_dir/fake_root/bin/lboxwm" "$install_tmp_dir/bin"
chmod 755 "$install_tmp_dir/bin/lboxwm"
mkdir -p "$install_tmp_dir/etc/xdg/lboxwm"
chmod 755 "$install_tmp_dir/etc"
chmod 755 "$install_tmp_dir/etc/xdg"
chmod 755 "$install_tmp_dir/etc/xdg/lboxwm"
cp -f "$build_dir/fake_root/etc/xdg/lboxwm/rc.xml" "$install_tmp_dir/etc/xdg/lboxwm/rc.xml"
chmod 644 "$install_tmp_dir/etc/xdg/lboxwm/rc.xml"
cp -f "$build_dir/fake_root/etc/xdg/lboxwm/rc.xsd" "$install_tmp_dir/etc/xdg/lboxwm/rc.xsd"
chmod 644 "$install_tmp_dir/etc/xdg/lboxwm/rc.xsd"

install_dirs "$builders_dir_root/$pkg_name/runtime.dirs"
install_files "$builders_dir_root/$pkg_name/runtime.files" "$install_tmp_dir"
elf_strip "$builders_dir_root/$pkg_name/elf-strip"

rm -Rf "$install_tmp_dir"
rm -Rf "$build_dir"
rm -Rf "$pkg_dir"
